using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class DevicePerformanceUtil_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(global::DevicePerformanceUtil);
            args = new Type[]{};
            method = type.GetMethod("Initial", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Initial_0);
            args = new Type[]{};
            method = type.GetMethod("GetDevicePerformanceLevel", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetDevicePerformanceLevel_1);
            args = new Type[]{typeof(System.Int32), typeof(System.Int32), typeof(System.Int32)};
            method = type.GetMethod("ModifySettingsBasedOnPerformance", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ModifySettingsBasedOnPerformance_2);
            args = new Type[]{};
            method = type.GetMethod("ModifySettingsBasedOnPerformance", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ModifySettingsBasedOnPerformance_3);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("SetQualitySettingsByLua", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetQualitySettingsByLua_4);
            args = new Type[]{typeof(global::QualityLevel)};
            method = type.GetMethod("SetQualitySettings", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetQualitySettings_5);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("SetResolutionLevel", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetResolutionLevel_6);
            args = new Type[]{typeof(System.Single)};
            method = type.GetMethod("SetResolutionRatio", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetResolutionRatio_7);

            field = type.GetField("qualityLevel", flag);
            app.RegisterCLRFieldGetter(field, get_qualityLevel_0);
            app.RegisterCLRFieldSetter(field, set_qualityLevel_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_qualityLevel_0, AssignFromStack_qualityLevel_0);




        }


        static StackObject* Initial_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            global::DevicePerformanceUtil.Initial();

            return __ret;
        }

        static StackObject* GetDevicePerformanceLevel_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            var result_of_this_method = global::DevicePerformanceUtil.GetDevicePerformanceLevel();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* ModifySettingsBasedOnPerformance_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @highQuality = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @midQuality = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Int32 @lowQuality = ptr_of_this_method->Value;


            global::DevicePerformanceUtil.ModifySettingsBasedOnPerformance(@lowQuality, @midQuality, @highQuality);

            return __ret;
        }

        static StackObject* ModifySettingsBasedOnPerformance_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            var result_of_this_method = global::DevicePerformanceUtil.ModifySettingsBasedOnPerformance();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* SetQualitySettingsByLua_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @value = ptr_of_this_method->Value;


            global::DevicePerformanceUtil.SetQualitySettingsByLua(@value);

            return __ret;
        }

        static StackObject* SetQualitySettings_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            global::QualityLevel @qLevel = (global::QualityLevel)typeof(global::QualityLevel).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)20);
            __intp.Free(ptr_of_this_method);


            global::DevicePerformanceUtil.SetQualitySettings(@qLevel);

            return __ret;
        }

        static StackObject* SetResolutionLevel_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @level = ptr_of_this_method->Value;


            global::DevicePerformanceUtil.SetResolutionLevel(@level);

            return __ret;
        }

        static StackObject* SetResolutionRatio_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Single @ratio = *(float*)&ptr_of_this_method->Value;


            global::DevicePerformanceUtil.SetResolutionRatio(@ratio);

            return __ret;
        }


        static object get_qualityLevel_0(ref object o)
        {
            return global::DevicePerformanceUtil.qualityLevel;
        }

        static StackObject* CopyToStack_qualityLevel_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = global::DevicePerformanceUtil.qualityLevel;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_qualityLevel_0(ref object o, object v)
        {
            global::DevicePerformanceUtil.qualityLevel = (global::QualityLevel)v;
        }

        static StackObject* AssignFromStack_qualityLevel_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            global::QualityLevel @qualityLevel = (global::QualityLevel)typeof(global::QualityLevel).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)20);
            global::DevicePerformanceUtil.qualityLevel = @qualityLevel;
            return ptr_of_this_method;
        }




    }
}
